package com.puzzud.engine.input;

import com.puzzud.engine.input.InputDevice;

import java.awt.event.KeyEvent;
import java.util.Vector;

// InputMouse
public class InputMouse extends InputDevice
{
	protected int XPosition;
	protected int YPosition;
	protected int XDragOrigin;
	protected int YDragOrigin;
	protected int XDragEnd;
	protected int YDragEnd;
	protected int XVelocity;
	protected int YVelocity;
	protected boolean draggable;
        protected boolean dragging;
        protected boolean dragEnded;

        public static final int BUTTON_STATE_UP				= InputButton.STATE_UP;
	public static final int BUTTON_STATE_RELEASED			= InputButton.STATE_RELEASED;
	public static final int BUTTON_STATE_PRESSED			= InputButton.STATE_PRESSED;
	public static final int BUTTON_STATE_DOWN			= InputButton.STATE_DOWN;
	
	public InputMouse()
	{
		super();
		
		setBufferSize( 10 );	// Default size of key buffer (5 fingers * 2 key states)
		
		XPosition = 0;
		YPosition = 0;
		XDragOrigin = 0;
		YDragOrigin = 0;
		XDragEnd = 0;
		YDragEnd = 0;
		XVelocity = 0;
		YVelocity = 0;
		draggable = false;
                dragging = false;
                dragEnded = false;
	}
	
	public void setPosition( int x, int y )
	{
		XPosition = x;
		YPosition = y;

                dragEnded = false;
	}
	
	public int getXPosition()
	{
		return( XPosition );
	}
	
	public int getYPosition()
	{
		return( YPosition );
	}
	
	public void setDragOrigin( int x, int y )
	{
		XDragOrigin = x;
		YDragOrigin = y;

                dragging = true;
                dragEnded = false;
	}
	
	public int getXDragOrigin()
	{
		return( XDragOrigin );
	}
	
	public int getYDragOrigin()
	{
		return( YDragOrigin );
	}
	
	public void setDragEnd( int x, int y )
	{
		XDragEnd = x;
		YDragEnd = y;

                dragEnded = true;
	}
	
	public int getXDragEnd()
	{
		return( XDragEnd );
	}
	
	public int getYDragEnd()
	{
		return( YDragEnd );
	}
	
	public void setVelocity( int xv, int yv )
	{
		XVelocity = xv;
		YVelocity = yv;
	}
	
	public int getXVelocity()
	{
		return( XVelocity );
	}
	
	public int getYVelocity()
	{
		return( YVelocity );
	}

    public boolean isDraggable()
    {
        return( draggable );
    }

    public void setDraggable( boolean draggable )
    {
        this.draggable = draggable;
    }

    public boolean isDragging()
    {
        return( dragging );
    }

    public void setDragging( boolean dragging )
    {
        this.dragging = dragging;
    }

    public boolean isDragEnded()
    {
        return( dragEnded );
    }
/*
    public void setDragEnded( boolean dragEnded )
    {
        this.dragEnded = dragEnded;

        setDragEnd( getXPosition(), getYPosition() );
    }
*/

}
